<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;


class Home extends Controller
{
    public function index(Request $request)
    {
        $sid = $request->get('sid','');
        if ($sid){
            return redirect('/home');
        }
        return view('index');
    }

    public function welcome()
    {
/*        $data = [
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '渠道列表',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'channel',
                'r_css'  => '',
                'r_show' => '1',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '获取子渠道',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'channel/getChild',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '合作列表',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'channel/cooperate',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '获取游戏供应商',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'getSupplier',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '游戏列表',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'game',
                'r_css'  => '',
                'r_show' => '1',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '游戏包上传',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'uploadchunk',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],
            [
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '游戏上传',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'game/uploadFile',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],[
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '获取游戏配置',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'gameConfig/getGames',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],[
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '检查游戏',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'checkGame',
                'r_css'  => '',
                'r_show' => '0',
                'r_sort' => '0',
                'type'   => '0',
            ],[
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '游戏配置列表',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'gameConfig',
                'r_css'  => '',
                'r_show' => '1',
                'r_sort' => '0',
                'type'   => '0',
            ],[
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '支付设置',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'payConfig',
                'r_css'  => '',
                'r_show' => '1',
                'r_sort' => '0',
                'type'   => '0',
            ],[
                'r_parent' => 220,
                'menu_type' => 2,
                'r_menu' => '打包列表',
                'r_control' => 'nonPublicVersion',
                'r_fun'  => 'gamePackage',
                'r_css'  => '',
                'r_show' => '1',
                'r_sort' => '0',
                'type'   => '0',
            ],
        ];*/

        /*foreach ($data as $item){

            $params = [
                'url' => 'http://zy.zhiyugame.com/Admin/Manager/rule_save.html',
                'isPost' => false,  //post方式
                'dataStr' => $item,
                'headers' => [
                    'Cookie:PHPSESSID=lprr4jae5dt1orjan76dj6t7j2'
                ]
            ];
            $res = Curl::query($params);
            dump(json_decode($res));
        }*/


        return view('welcome');
    }

    public function jump()
    {
        return view('jump');
    }
}
